<?php
require_once './connect.php';
//{app_id:"",app_date:"",app_time}
//处理数据
$doc_id=$data['doc_id'];
$datalist=array();
/*$sql = "SELECT doc_id FROM _doctor where doc_name='$doc_name'";
$result = $conn->query($sql);
if($result->num_rows>0){
    $row = $result->fetch_assoc();
    $doc_id=$row['doc_id'];
}*/
$sql = "SELECT app_id,app_date,app_time FROM _appoint where doc_id='$doc_id'";
$result = $conn->query($sql);
if($result->num_rows>0)
{
    while($row=$result->fetch_assoc()){
        $app_id=$row['app_id'];
        $app_date=$row['app_date'];
        $app_time=$row['app_time'];
        if($app_time==='0'){
            $app_time='上午';
        }
        else if($app_time==='1') {
            $app_time = '下午';
        }
        $datasingle=array('app_id'=>$app_id,'app_date'=>$app_date,'app_time'=>$app_time);
        array_push($datalist,$datasingle);
    }
}
$datalist=array('dataList' => $datalist);
$response=array(
    'resultCode'=>'0',
    'resultObject'=> $datalist,
    'resultMsg'=>'成功'
);
//echo 'test';
echo json_encode($response);
$conn->close();
?>